package engine;

/**
 * Polar Vector
 * 
 * Vector representation using radius, angle format
 * 
 * @author Dylan
 *
 */
public class PolarVector {
	private double angle;
	private double radius;
	
	public PolarVector(double angle, double radius){
		setAngle(angle >= 0? angle : angle + Math.PI * 2);
		setRadius(radius);
	}
	
	/**
	 * Convert the polar vector into a linear vector
	 * 
	 * @return
	 */
	public Vector toVector(){
		return new Vector(Math.cos(angle) * radius, Math.sin(angle) * radius);
	}

	public double getAngle() {
		return angle;
	}

	public void setAngle(double angle) {
		this.angle = angle;
	}

	public double getRadius() {
		return radius;
	}

	public void setRadius(double radius) {
		this.radius = radius;
	}
	
	public void print() {
		System.out.println("r = " + radius + "; a = " + angle + "/" + angle * 180 / Math.PI + ";");
	}
}
